import 'package:flutterproject/mvvm/base/base_controller.dart';
import 'package:flutterproject/page/quota/data/quota_bean.dart';
import 'package:flutterproject/util/address_manager.dart';
import 'package:flutterproject/util/dialog_toast/toast_util.dart';
import 'package:flutterproject/util/http/http_client.dart';
import 'package:flutterproject/util/http/http_exception.dart';
import 'package:get/get.dart';

class QuotaController extends BaseController {
  HttpClient client = Get.find<HttpClient>();

  QuotaBean? bean = QuotaBean();


  @override
  void onReady() {
    super.onReady();
    getData();
  }

  Future getData() async {
    try {
      bean = await client.get<QuotaBean>(AddressManager.quota);
      update();
      return true;
    } on HttpException catch (e) {
      ToastUtil.showFailed(e.message);
      return false;
    }
  }
}
